<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<!-- remove old header -->


<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>cogen API Reference Documentation
        - Module: schedulers</title><meta name="MSSmartTagsPreventParsing" content="true" /><meta http-equiv="imagetoolbar" content="no" /><link href="css/default.css" rel="stylesheet" type="text/css" /><link href="css/pygments.css" rel="stylesheet" type="text/css" />
    <!-- <link rel="shortcut icon" href="/images/favicon.ico" type="image/vnd.microsoft.icon"/> -->
    <link rel="stylesheet" href="css/apydia.css" type="text/css" />
    <script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script>
    <script src="js/apydia.js" type="text/javascript"></script>
	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
</head>
<body>
    <div id="page">
        <div id="browser">
            <div class="browser-section">
                <h2>Module Index</h2>
                <ul>
                    <li>
                        <a href="cogen.html">cogen</a>
                    </li><li>
                        <a href="cogen.common.html">cogen.common</a>
                    </li><li>
                        <a href="cogen.core.html">cogen.core</a>
                    </li><li>
                        <a href="cogen.core.coroutines.html">cogen.core.coroutines</a>
                    </li><li>
                        <a href="cogen.core.events.html">cogen.core.events</a>
                    </li><li>
                        <a href="cogen.core.pubsub.html">cogen.core.pubsub</a>
                    </li><li>
                        <a href="cogen.core.queue.html">cogen.core.queue</a>
                    </li><li>
                        <a href="cogen.core.reactors.html">cogen.core.reactors</a>
                    </li><li>
                        <a href="cogen.core.reactors.base.html">cogen.core.reactors.base</a>
                    </li><li>
                        <a href="cogen.core.reactors.iocp_proactor.html">cogen.core.reactors.iocp_proactor</a>
                    </li><li>
                        <a href="cogen.core.reactors.poll_reactor.html">cogen.core.reactors.poll_reactor</a>
                    </li><li>
                        <a href="cogen.core.reactors.qt_reactor.html">cogen.core.reactors.qt_reactor</a>
                    </li><li>
                        <a href="cogen.core.reactors.select_reactor.html">cogen.core.reactors.select_reactor</a>
                    </li><li class="active">
                        <a href="cogen.core.schedulers.html">cogen.core.schedulers</a>
                    </li><li>
                        <a href="cogen.core.sockets.html">cogen.core.sockets</a>
                    </li><li>
                        <a href="cogen.core.util.html">cogen.core.util</a>
                    </li><li>
                        <a href="cogen.web.html">cogen.web</a>
                    </li><li>
                        <a href="cogen.web.async.html">cogen.web.async</a>
                    </li><li>
                        <a href="cogen.web.wsgi.html">cogen.web.wsgi</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Classes</h2>
                <ul>
                    <li>
                        <a href="cogen.core.schedulers.Scheduler.html">Scheduler</a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
    <h1>Module:
        cogen.core.schedulers
    </h1>
    <div class="docstring rst"><p>Scheduling framework.</p>
<p>The scheduler handles the timeouts, run the operations and does very basic
management of coroutines. Most of the heavy logic is in each operation class.
See: <a class="reference" href="cogen.core.events.html">events</a> and <a class="reference" href="cogen.core.sockets.html">sockets</a>.
Most of those operations work with attributes we set in the scheduler.</p>
<p><cite>cogen</cite> is multi-state. All the state related to coroutines and network is in
the scheduler and it's associated reactor. That means you could run several
cogen schedulers in the same process/thread/whatever.</p>
<p>There is just one thing that uses global objects - the threadlocal-like local
object in the coroutines module.  It was actually aded for the wsgiserver
factory that monkey patches the threadlocal module in order to make pylons run
correctly (pylons relies heavily on threadlocals).</p>
</div>
    <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk/cogen/core/schedulers.py#1">View source</a>
    </li>
</ul>
    <div>
        <h2>Classes</h2>
            <h3>
                <a href="cogen.core.schedulers.Scheduler.html">Scheduler</a>
            </h3>
            <div class="docstring rst"><p>Basic deque-based scheduler with timeout support and primitive
prioritisaiton parameters.</p>
<p>Usage:</p>
<div class="source"><pre><span class="n">mysched</span> <span class="o">=</span> <span class="n">Scheduler</span><span class="p">(</span><span class="n">reactor</span><span class="o">=</span><span class="n">DefaultReactor</span><span class="p">,</span>
        <span class="n">default_priority</span><span class="o">=</span><span class="n">priority</span><span class="o">.</span><span class="n">LAST</span><span class="p">,</span> <span class="n">default_timeout</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
</pre></div>
<ul class="simple">
<li>reactor: a reactor class to use</li>
<li>default_priority: a default priority option for operations that do not
set it. check <a class="reference" href="cogen.core.util.priority.html">priority</a>.</li>
<li>default_timeout: a default timedelta or number of seconds to wait for
the operation, -1 means no timeout.</li>
</ul>
</div>
            <ul class="link-bar">
    <li>
        <a href="cogen.core.schedulers.Scheduler.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk/cogen/core/schedulers.py#43">View source</a>
    </li>
</ul>
    </div>
        </div>
        <div id="footer">
            Generated with <a href="http://apydia.ematia.de/" class="extern">
            Apydia 0.0.3</a>
        </div>
    </div>
</body>
</html>